package ev.operator;//need to add this line

//import ev.data.*;//need to add this line
import java.util.Random;

/*
 * Pick two alleles at random and swap their positions
 * Preserves most of adjacency information (4 links broken), disrupts
 * order more
 */
public class Swap implements Mutation{
	public boolean[] mutate(boolean[] a) {
		int len=a.length;

		//generate position randomly
		Random r=new Random();
		int position=r.nextInt(len);
		a[position]=r.nextBoolean();
		return a;
	}

	public int[] mutate(int[] a) {

		int len=a.length;
		Random r=new Random();
		int start=r.nextInt(len);
		a[start]=r.nextInt(1001)+200;
		return a;
	}	
}
